package com.lzxuni.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.lzxuni.mapper.ForwardMapper;
import com.lzxuni.po.ForwardCostom;
import com.lzxuni.service.ForwardService;

@Service("forwardService")
public class ForwardServiceImpl implements ForwardService{
    @Autowired
    private ForwardMapper forwardMapper;
	
	@Override
	public void insertForward(ForwardCostom forwardCostom) throws Exception {
		forwardMapper.insertForward(forwardCostom);
	}

	@Override
	public PageInfo<?> findForwardList(int pageNumber, int pageSize,ForwardCostom forwardCostom) throws Exception {
		PageHelper.startPage(pageNumber, pageSize).setOrderBy("createTime desc");
		List<ForwardCostom> list = forwardMapper.findForwardList(forwardCostom);
		PageInfo pageInfo = new PageInfo(list);
		return pageInfo;
	}

	@Override
	public ForwardCostom findForwardById(String userkey) throws Exception {
		
		return forwardMapper.findForwardById(userkey);
	}

	@Override
	public void updateForward(ForwardCostom forwardCostom) throws Exception {
		forwardMapper.updateForward(forwardCostom);
		
	}

	@Override
	public void delForward(String id) throws Exception {
		forwardMapper.delForward(id);
		
	}

	@Override
	public List<ForwardCostom> findForwardList(ForwardCostom forwardCostom)
			throws Exception {
		return forwardMapper.findForwardList(forwardCostom);
	}
 
}
